﻿#region Copyright information
// 
// Copyright © 2005-2013 Yongkee Cho. All rights reserved.
// 
// This code is a part of the Biological Object Library and governed under the terms of the
// GNU Lesser General  Public License (LGPL) version 2.1 which accompanies this distribution.
// For more information on the LGPL, please visit http://bol.codeplex.com/license.
// 
// - Filename: SimpleGeneFinder.cs
// - Author: Yongkee Cho
// - Email: yongkeecho@gmail.com
// - Date Created: 2013-01-24 4:34 PM
// - Last Modified: 2013-01-25 3:59 PM
// 
#endregion
using System.Collections.Generic;
using BOL.Maths.Distributions;

namespace BOL.Algorithms.StateMachines.Models
{
    public enum SimpleGeneFinderState { Coding, NonCoding }

    /// <summary>
    /// Models a simple 2-state gene finder.
    /// </summary>
    public class SimpleGeneFinder : HiddenMarkovModel<SimpleGeneFinderState, char>
    {
        public SimpleGeneFinder()
            : base(
                new Dictionary<SimpleGeneFinderState, double> { { SimpleGeneFinderState.Coding, 0.5 }, { SimpleGeneFinderState.NonCoding, 0.5 } },
                new Dictionary<SimpleGeneFinderState, IDistribution<char>>
                {
                    { SimpleGeneFinderState.Coding, new CategoricalDistribution<char>(new Dictionary<char, double> { { 'A', 0.35 }, { 'C', 0.15 }, { 'G', 0.15 }, { 'T', 0.35 } }) },
                    { SimpleGeneFinderState.NonCoding, new CategoricalDistribution<char>(new Dictionary<char, double> { { 'A', 0.15 }, { 'C', 0.35 }, { 'G', 0.35 }, { 'T', 0.15 } }) }
                },
                new Dictionary<SimpleGeneFinderState, IDistribution<SimpleGeneFinderState>>
                {
                    { SimpleGeneFinderState.Coding, new CategoricalDistribution<SimpleGeneFinderState>(new Dictionary<SimpleGeneFinderState, double> { { SimpleGeneFinderState.Coding, 0.999 }, { SimpleGeneFinderState.NonCoding, 0.001 } }) },
                    { SimpleGeneFinderState.NonCoding, new CategoricalDistribution<SimpleGeneFinderState>(new Dictionary<SimpleGeneFinderState, double> { { SimpleGeneFinderState.Coding, 0.01 }, { SimpleGeneFinderState.NonCoding, 0.99 } }) }
                }
            )
        {
        }
    }
}